package com.yoga.app.web;

import com.yoga.common.appexception.YogaResult;
import com.yoga.manager.upyun.UploadChannelEnum;
import com.yoga.manager.upyun.UploadUtils;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

/**
 * Created by chenjin on 2020/2/23.
 */

@RestController
@RequestMapping("${basePath}")
public class AppUploadController {

    @PostMapping("/upload-image")
    public YogaResult uploadImage(UploadChannelEnum uploadChannel, @RequestParam("file") MultipartFile file) {
        return new YogaResult(UploadUtils.upload(uploadChannel, file));
    }


}
